package com.fanjun.learning.multithread.Work_Thread_Pattern;

import java.util.Random;

/**
 * Created by fanjun on 16/10/11.
 */
public class Request {
    private final String name;
    private final int num;
    private static final Random random = new Random();
    public Request(String name, int num) {
        this.name = name;
        this.num = num;
    }

    public void execute(){
        System.out.println(Thread.currentThread().getName() + " executes " + this);
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public String toString(){
        return "[Request from " + name + "No." + num + "]";
    }

}
